# pip3 install celery
from celery import Celery

# redis的地址 broker = 'redis://:密码@127.0.0.1:6379/1'  # 如果有密码 //后加 :密码@
broker = 'redis://127.0.0.1:6379/1'
backend = 'redis://127.0.0.1:6379/2'

# 1实例化得到celery对象
app = Celery(__name__,broker=broker,backend=backend)

# 2 写一堆任务(a+b),函数
# 使用装饰器包裹任务
@app.task()
def add(a,b):
    return a+b